20240308-114042

最近更新了.wslconfig和升级了WSL 2.0版本突然就发现,无法使用cmake-gui,对于我这种点点小白来讲简直是噩梦。

在Arch Linux发行版下运行cmake-gui,具体就是会出现以下的报错:

Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: minimalegl, offscreen, linuxfb, minimal, wayland-egl, wayland, eglfs, xcb, vkkhrdisplay, vnc.

[1]    402421 IOT instruction (core dumped)  cmake-gui

简直就是编译路上的最大绊脚石,解决办法也是通过github得知:

# sudo nvim /etc/tmpfiles.d/wslg.conf
#  This file is part of the debianisation of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

# See tmpfiles.d(5) for details

# Type Path           Mode UID  GID  Age Argument
L+     /tmp/.X11-unix -    -    -    -   /mnt/wslg/.X11-unix